# @Time    :2025/4/8 23:47
def select_sort(alist):
    for i in range(len(alist) - 1):
        min_index = i
        for j in range(i + 1, len(alist)):
            if alist[j] < alist[min_index]:
                min_index = j
        alist[i], alist[min_index] = alist[min_index], alist[i]
    return alist

if __name__ == '__main__':
    print(select_sort([3, 4, 2, 1, 5, 6, 7, 8]))
